package com.zwan.oam_rtc.bean.appdemoentity;

import java.io.Serializable;
import java.util.List;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import lombok.Data;

@Data
public class SysUser extends BaseEntity implements Serializable{
    private static final long serialVersionUID = 1L;

    /**
     * 主键id
     */
    private Integer userId;

    /**
     * 用户名
     */
    private String userName;

    /**
     * 密码
     */
    private String password;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 手机号码
     */
    private String mobile;

    /**
     * 真实姓名
     */
    private String realName;

    /**
     * 企业id
     */
    private Integer companyId;

    /**
     * 用户状态；0正常1禁用 2试用
     */
    private String status;

    /**
     * 实名认证 0：未认证 1：已认证
     */
    private String certificationType;

    /**
     * 用户唯一码
     */
    private String qrcode;

    /**
     * 角色编号
     */
    private Integer roleId;

    /**
     * 分组编号
     */
    private Integer deptId;

//    @TableField(exist = false)
//    private List<SysRole> roles;
    /**
     * 角色组
     */
    private List<Integer> roleIds;
    /**
     * 验证码
     */
    private String code;
    private String roleKey;
    private List<SysMenu> menuList;
    private String zwannumber;
    private String zwanpassword;

    private Integer platform;
    private String liveStreamKey;

    public boolean isAdmin() {
        return isAdmin(this.userId);
    }

    public static boolean isAdmin(Integer userId) {
        return userId != null && -99 == userId;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("userId", getUserId())
                .append("password", getPassword()).append("userName", getUserName())
                .append("email", getEmail()).append("mobile", getMobile())
                .append("realName", getRealName()).append("companyId", getCompanyId())
                .append("status", getStatus()).append("roleId", getRoleId())
                .append("createBy", getCreateBy())
                .append("createTime", getCreateTime()).append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime()).append("remark", getRemark())
                .toString();
    }
}
